import React, { Component } from 'react'
import { NavLink, Switch, Route, Redirect } from 'react-router-dom'
import './home.css'
import News from './components/News'
import Message from './components/Message'

export default class Home extends Component {
  render() {
    // console.log('Home收到的props:', this.props)
    return (
      <div className="home">
        <p>🏠Home Content</p>
        <ul>
          <li>
            <NavLink to="/home/news">News</NavLink>
          </li>
          <li>
            <NavLink to="/home/msg">Message</NavLink>
          </li>
        </ul>
        <div className="main">
          <Switch>
            <Route path="/home/news" component={News}></Route>
            <Route path="/home/msg" component={Message}></Route>
            <Redirect to="/home/news"/>
          </Switch>
        </div>
      </div>
    )
  }
}
